/*
 * @Description: 
 * @Author: 赵大壮
 * @Date: 2021-12-06 17:18:37
 * @LastEditTime: 2021-12-06 17:36:29
 * @LastEditors: 赵大壮
 */
import dzMsgBox from "@/utils/DZMessageBox";
import { Component, Vue, Inject } from "vue-property-decorator";
import DZModelArticle from "../../model/DZModelArticle";
import DZServiceArticle from "../../service/DZServiceArticle";
import ny_config from "@/api/nyConfig";
import api from "@/api/nyApiJson";

@Component({
    components: {}
})
export default class Index extends Vue {

    s_article = new DZServiceArticle();
    // 保存进入编辑的cell
    clickCellMap: {}

    created() { }

    mounted() {
        this.s_article.net_list_type_dic();
        this.action_list_article(1);
    }

    beforeDestroy() {

    }

    action_list_article(cur_page) {
        this.s_article.net_list_article(cur_page);
    }

    action_page_add(articleId) {
        this.$router.push({ path: '/article/info', query: { articleId: articleId } })
    }

    action_details_article(item: DZModelArticle) {
        this.action_page_add(item.id);

    }
    action_del_article(item: DZModelArticle) {
        dzMsgBox.del("是否删除该文章", () => {
            this.s_article.net_del_article(item.id, () => {
                this.action_list_article(1);
            })
        })
    }

    action_page_change(cur_page) {
        this.s_article.m_page.page = cur_page;
        this.action_list_article(cur_page);
    }

    action_move_up(row) {
        this.s_article.net_move_up(row.id, () => {
            this.action_list_article(this.s_article.m_page.page);
        });
    }

    action_move_down(row) {
        this.s_article.net_move_down(row.id, () => {
            this.action_list_article(this.s_article.m_page.page);
        });
    }

    action_move_top(row) {
        this.s_article.net_move_top(row.id, () => {
            this.action_list_article(this.s_article.m_page.page);
        });
    }

    action_cancel_top(row) {
        this.s_article.net_cancel_top(row.id, () => {
            this.action_list_article(this.s_article.m_page.page);
        });
    }
}